package reflect;

import java.io.File;
import java.net.URISyntaxException;

public class Text2 {
    public static void main(String[] args) throws URISyntaxException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        //扫描当前目录下一共有多少个.class文件
        File file = new File(Text2.class.getResource(".").toURI());
        System.out.println(file);

        File[] files = file.listFiles(e->e.getName().endsWith(".class"));
        System.out.println(files.length);

        for(File file1 : files){
            System.out.println(file1.getName());
        }

        //查看string包下所有的类
        //C:\Users\Administrator\IdeaProjects\JavaSe\target\classes\reflect

        File dir = new File(Text2.class.getClassLoader().getResource("./String_demo").toURI());
        System.out.println(dir);

        File[] dir1 = dir.listFiles(e->e.getName().endsWith(".class"));
        System.out.println(dir1.length);

        for(File dir2 : dir1){
            System.out.println(dir2.getName());
        }

    }
}
